<?php

namespace App\Policies;

use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class UserPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
     //更新
   public function update(User $currentUser,User $user)
   {

       return $currentUser->id === $user->id;
   }
   //删除[当前用户是本人且为管理员才能看到删除按钮]
   public function destroy(User $currentUser,User $user)
   {
       return $currentUser->is_admin && $currentUser->id !== $user->id;
   }

}
